Skip to content

IAM: preserve case-sensitive managed-policy tag keys - #10550

Open
narayana006 wants to merge 1 commit into
getmoto:masterfrom
narayana006:candidate/iam-policy-tag-case
Open

narayana006 wants to merge 1 commit into
getmoto:masterfrom
narayana006:candidate/iam-policy-tag-case

Conversation

@narayana006

Copy link
Copy Markdown

IAM: preserve case-sensitive managed-policy tag keys

Managed policy tags incorrectly share the case-insensitive normalization used for users and roles. CreatePolicy rejects Costcenter and costcenter together, TagPolicy overwrites a differently cased key, and UntagPolicy can remove the wrong tag.

Allow tag validation to preserve exact keys for managed policies. Keep the existing default for users and roles, and remove only an exact policy tag key. Regression tests cover creation, updates, and removal. Replace two old negative tests whose case-insensitive policy-tag expectation contradicts AWS's documented contract; exact duplicate-key rejection remains covered.

Expected behavior follows AWS's IAM tag case-sensitivity documentation.

Validation: all three new regressions fail before the fix. All 388 IAM tests pass with the fix, including existing role-tag tests. Repository-wide Ruff checks and formatting, targeted mypy for moto/iam/models.py, and git diff --check pass. No real AWS verification or full-project mypy is claimed. Other IAM resource types using the same helper are outside this scoped managed-policy proposal.

Prepared with OpenAI Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant